package contegor.scire.core.queries;

import contegor.scire.core.Connectable;
import contegor.scire.core.Container;
import contegor.scire.core.Id;
import contegor.scire.core.TaskId;
import contegor.scire.core.TaskImpl;
import contegor.scire.core.Version;

/**
 * Base class for all queries.
 *
 * @version $Revision: 1.4 $
 * @author  Héctor Cirbián Pousa ($Author: hector $)
 */
@Version("$Id: Query.java,v 1.4 2010-02-01 10:55:42 hector Exp $")
public abstract class Query<R extends Connectable> extends TaskImpl<R> {
  private static final long serialVersionUID = 1885334619693336408L;

  public Query(Id containerId) {
    super(containerId);
  }

  /**  <b>Internal use only.</b> */
  protected Query(TaskId taskId, Id containerId) {
    super(taskId, containerId);
  }

  protected void internalChecks(Container targetContainer) {
    assert (returnPoint != null);
    assert (targetContainer.getId().equals(this.targetContainerId));
  }

  /* TODO: Study the most concurrent Queries to see what is better: that they share the same ReturnPoint
     using synchronized structures or different ReturnPoint that consolidate results at the end. */
}